home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / jhtools.exe / REGHELP.TXT < prev    next >
Encoding:
Text File  |  1992-02-08  |  31.8 KB  |  1,334 lines

  1. *
  2.                                *
  3.       *
  4.                        *                      *
  5.  
  6.  
  7.                 *              *              *
  8.      *
  9.                        *           *
  10.  
  11.  
  12.      *             *           *
  13.                                                *
  14.                                    #
  15.                #####      #   #     #    ####
  16.                  #        #   #         #
  17.                  #    *   #####          ###     *
  18.    *             #        #   #             #
  19.               ####        #   #   *     ####
  20.  
  21.  
  22.                                           *
  23.          *
  24.                           *
  25.  
  26.                                                    *
  27.                   *        *          *
  28.  *
  29.  
  30.       ####        ###   ####  #     #  ####   ###
  31.       #           #  #  #  #  #     #  #     #   #
  32.       #       *   ###   #  #  #  #  #  ###   ####       *
  33.  *    #           #     #  #  # # # #  #     # #
  34.       ####        #     ####   #  *#   ####  #  #
  35.                                       *
  36.         *           *
  37.  *                           *                     *
  38.        *
  39.                       *           *
  40.  
  41.  
  42.               *             *
  43.                                          *
  44.            *
  45.                #####  #####   #####   #       ####*
  46.     *            #    #   #   #   #   #      #
  47.                * #    #   #   #   #   #*      ###
  48.                  #    #   #   #   #   #          #
  49.                  #    #####   #####   ####    ###
  50.                 *
  51.                            *                *
  52.      *
  53.            *                         *            *
  54.                          *    VERSION 1.0
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.      Welcome to the JH'S C POWER TOOLS sharewhare manual.  This
  65.  
  66. manual is mainly designed for those c programers who wish to
  67.  
  68. understand how to use the libarary's functions.  If you want to
  69.  
  70. know how the programs work or why they made the way they were you
  71.  
  72. will need to get the expanded manual that comes with the registered
  73.  
  74. version.
  75.  
  76.      The disks that were mailed to you should include the
  77.  
  78. following:
  79.  
  80.      READx.EXE
  81.  
  82.      MENUx.LIB
  83.  
  84.      UTLx.LIB
  85.  
  86.      MOUSx.LIB
  87.  
  88.      KEYx.H
  89.  
  90.      MENx.H
  91.  
  92.      SHAPEx.H
  93.  
  94.      REGHELPx.TXT  (This file)
  95.  
  96. The x by each name is the version number.
  97.  
  98. If you did not receive any of the following please contact me
  99.  
  100. via my E-MAIL number or by regular mail and I will get a
  101.  
  102. replacement copy to you ASAP.
  103.  
  104.      Thank you for you support.
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.      MENUx.C HELP SECTION:
  119.  
  120.  
  121.  
  122.      This is the menu help section.  In this section I will
  123.  
  124. go through each function one by one and explain how to call each
  125.  
  126. function and what it returns.
  127.  
  128.      Before I start with the functions I am going to go over
  129.  
  130. some basics that you will need to know in order to understand
  131.  
  132. the functions.
  133.  
  134.  
  135.  
  136. POINTERS:
  137.  
  138.  
  139.  
  140.      The usefulness of pointers come from the fact that in
  141.  
  142. all C functions varibles are passed by value and since
  143.  
  144. functions only recieve local varibles it can not change the
  145.  
  146. original values that the varible represents.  Pointers make
  147.  
  148. this possible.  Another use for pointers is the manipulating
  149.  
  150. of an array by moving the pointers to its elements.
  151.  
  152.      A pointer is a varible that holds the address of an
  153.  
  154. object (it "points" to the address in memory where the
  155.  
  156. varible is stored.)
  157.  
  158. DEFINATION OF POINTERS:
  159.  
  160.      All C varibles need to be defined and pointers are no
  161.  
  162. different.  Below are some examples of how to declare
  163.  
  164. pointers:
  165.  
  166.      int *ptr;  /* This is a pointer to an interger */
  167.  
  168.      char *buffer;  /* This is a pointer to a character */
  169.  
  170.      char *buffer[]={
  171.  
  172.      " This is a pointer ",
  173.  
  174.      " to an array of ",
  175.  
  176.      " characters ",
  177.  
  178.      ""};
  179.  
  180. In the last case:
  181.  
  182.                  *buffer[1]=this is a pointer
  183.  
  184.                  *buffer[2]=to an array of
  185.  
  186.                  *buffer[3]=characters
  187.  
  188. Any normal varible type that can be defined can also be
  189.  
  190. defined as a pointer.
  191.  
  192.  
  193.  
  194. HOW TO USE POINTERS:
  195.  
  196.      Example:
  197.  
  198.      1)     int x=1,y=2,z=3;
  199.  
  200.      2)     int *xx,*yy,*zz;
  201.  
  202.      3)     xx=&x;
  203.  
  204.      4)     yy=&y;
  205.  
  206.      5)     zz=&z;
  207.  
  208.      6)     printf(" x= %d\n y= %d\n z= %d\n",x,y,z);
  209.  
  210.      7)     printf(" *xx=%d\n*yy=%d\n*zz=%d\n",*xx,*yy,*zz);
  211.  
  212.      8)     printf(" &x=%u\n &y=%u\n &z=%u\n",&x,&y,&z);
  213.  
  214.      9)     printf(" xx=%u\n yy=%u\n zz=%u\n",xx,yy,zz);
  215.  
  216. Alright you know that a pointer "points" to the address where
  217.  
  218. a varible is stored.  Right, good now here is where we start
  219.  
  220. to get tricky.  The '&' operater means "the address of" and *
  221.  
  222. means "what is pointed to by."
  223.  
  224. So in line 3 you would want to read it as "xx equals the
  225.  
  226. address of x."  There for you now know that the pointer xx is
  227.  
  228. pointing to the varible x.  If you follow that reasoning you
  229.  
  230. could come up with the conclusion that in line 7 where we are
  231.  
  232. printing out what is being pointed to by xx it should be the
  233.  
  234. same value as x.  Try to figure out what will be printed out
  235.  
  236. before you run this program and then see if you are right.
  237.  
  238. If so continue on.
  239.  
  240.  
  241.  
  242.  
  243.  
  244. VARIBLES AND FUNCTIONS:
  245.  
  246.      Earlier we stated the fact that we use pointers to
  247.  
  248. change the value of a varible in a function that was passed
  249.  
  250. to it.  With out pointers you could only return one varible
  251.  
  252. from a function but with pointers you can change many
  253.  
  254. varibles and have them stay changed when you leave the
  255.  
  256. function.  This section will show you how it is done.
  257.  
  258.      Example:
  259.  
  260.      1)   main() {
  261.  
  262.      2)   int x=0,y=0;
  263.  
  264.      3)   printf("x=%d/ny=%d",x,y);
  265.  
  266.      4)   change(&x,&y);
  267.  
  268.      5)   printf("x=%d\ny=%d",x,y);
  269.  
  270.      6)   }
  271.  
  272.      7)   change(int *x,int *y) {
  273.  
  274.      8)   *x=3;
  275.  
  276.      9)   *y=5; }
  277.  
  278. This program will change the varible x and y to 3 and 5
  279.  
  280. respectively and they will remain changed when they return to
  281.  
  282. the main function.  Now we can return more than one varible
  283.  
  284. from a function.
  285.  
  286.      When you pass an array of pointers to a function you
  287.  
  288. don't have to pass each element of the array you can pass
  289.  
  290. just the name.  For example if you have an array of intergers
  291.  
  292. defined as int *num={ 5, 10, 15, 20 } when you call the
  293.  
  294. function you can call it like this 'function(num)' and the
  295.  
  296. whole array will be passed.
  297.  
  298.  
  299.  
  300.  
  301.  
  302. MISC POINTER FUNCTIONS:
  303.  
  304.      Say for example you have two pointers and you want to
  305.  
  306. point to the same address:
  307.  
  308.      pointer1=pointer2
  309.  
  310. and it is done.
  311.  
  312.      Say you have a pointer to an array and you want to go to
  313.  
  314. the next element in the array:
  315.  
  316.      pointer++
  317.  
  318. and it is done.  Maybe you want to go to the previous
  319.  
  320. element:
  321.  
  322.      pointer--
  323.  
  324. and it is done.
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332. POINTERS AND MY LIBARIES:
  333.  
  334.      I used a lot of pointers in my menu libary mainly
  335.  
  336. because I am using direct memory addressing and it make it a
  337.  
  338. lot easier to use pointer rather than varibles.  I also tend
  339.  
  340. to wnat to pass more than one varible back the the parent
  341.  
  342. function.  You have a basic understanding of pointers now so
  343.  
  344. you should be able to understand must of what I am doing with
  345.  
  346. them.  For more infomation you can look an almost any C
  347.  
  348. manual and they will give you about a ten to fifteen page
  349.  
  350. lession on pointers.  If you still have question fill free to
  351.  
  352. contact me.
  353.  
  354.  
  355.  
  356. INTERRUPTS:
  357.  
  358.  
  359.  
  360.      Interrupts are a neat and somtimes tricky part of your
  361.  
  362. DOS and BIOS enviroment.  If you are not sure what they are
  363.  
  364. and how they work pick up almost any DOS reference manual and
  365.  
  366. turn to the interrupt section and start reading you can find
  367.  
  368. a LOT of interesting things that you can put in your programs
  369.  
  370. that you throught were impossible to do.
  371.  
  372.      An interrupt is a signal to the processor from a program
  373.  
  374. that tells the processor to temporarily suspend the current
  375.  
  376. function that the CPU is working on and proform another task
  377.  
  378. defined by the interrupt function number.  Each interrupt
  379.  
  380. function has a section of coded called an interrupt service
  381.  
  382. routine that is memory resident just like any TSR program.
  383.  
  384. So each time your program call an interrupt the interrupt
  385.  
  386. service routine is run.  In order for us to call an interrupt
  387.  
  388. in C yor need to run one of the interrupt's call routines
  389.  
  390. which are INT86(), INT86X(), INTDOS(), INTDOSX().  You will
  391.  
  392. mainly want to use INT86.  This function can be used to call
  393.  
  394. any DOS or BIOS interrupt function while INTDOS can be used
  395.  
  396. to call only DOS interrupt functions.  The X that are part
  397.  
  398. of two of the functions means that you have information in
  399.  
  400. the segment registers.
  401.  
  402.      In order for any interrupt function to be called you
  403.  
  404. need information in the registers below shows in example of a
  405.  
  406. interrupt call.
  407.  
  408.      1)   union REGS regs;
  409.  
  410.      2)   regs.h.ah=2;
  411.  
  412.      3)   regs.x.bx=45;
  413.  
  414.      4)   int86(0x10,®s,®s);
  415.  
  416.      6)   go=regs.x.ax;
  417.  
  418. This function does not do any thing I made up numbers as I
  419.  
  420. went along so I strongly seggest you do not type this into
  421.  
  422. you computer and run it.
  423.  
  424.      Line one defines the input and output from the interrupt
  425.  
  426. function.  the REGS in capital letters tell the compiler that
  427.  
  428. the union regs will be used with an interrupt.
  429.  
  430.      regs.h.ah=2 moves the number 2 into the ah register
  431.  
  432. regs.c.bx=45 moves 45 into the bx register.
  433.  
  434.      Line 4 calls interrupt 0x10 and line 5 moves whatever is
  435.  
  436. in the ax register into the varible go.
  437.  
  438.  
  439.  
  440.  
  441.  
  442. MENUx.C FUNCTIONS:
  443.  
  444.  
  445.  
  446. FOREWORD:
  447.  
  448.  
  449.      If you are making a program that has a lot of differnt
  450.  
  451. menus you will need to make sure you free each pointer after
  452.  
  453. you use it otherwise you will get a stack overflow error.  If
  454.  
  455. you have freed all of the pointers you think you possibly can
  456.  
  457. and you still get an overflow error refer to your compilers
  458.  
  459. manual on how to raise the stack settings.
  460.  
  461.      If for some reason these functions are not compatible
  462.  
  463. with you compiler please contact me via E-Mail or regular
  464.  
  465. mail and I will do my best to get you a version that will be
  466.  
  467. compatible.  These function were written in Quick C 2.5 which
  468.  
  469. is compatible with MSC.  I don't have access to Turbo C but
  470.  
  471. as far as I know they should be compatible with that also.
  472.  
  473. Hopefully before the next version is released I will be able
  474.  
  475. to get Turbo C also so I can check the functions on that one
  476.  
  477. also.
  478.  
  479.      From here-on-out when you see a number with an 0x in
  480.  
  481. front of it that means it is in hex format.  If their is
  482.  
  483. nothing before it that means it is in dec format.
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490. MODE(INT MODE_CODE)
  491.  
  492.  
  493.      This function sets the video mode to the mode defined by
  494.  
  495. mode_code.
  496.  
  497.      This function calls the BIOS interrupt 0x10 (hex 10 dec
  498.  
  499. 16) service 0 and passes it,via the al register, which mode
  500.  
  501. you want the screen to be.  All of the functions in this
  502.  
  503. libary can use modes 0, 1, 2 and 3.  I usually use mode 3
  504.  
  505. which is an 80x25 text mode with 16 colors.
  506.  
  507.  
  508.  
  509.  
  510. GET_CURR(),GET_CURC()
  511.  
  512.      These two functions get the current cursor position.
  513.  
  514. Get_curr() returns the current cursor row and get_curc()
  515.  
  516. returns the current cursor column.
  517.  
  518.      These functions call the BIOS interrupt 0x10 (just like
  519.  
  520. the last function but instead of using service 0 it uses
  521.  
  522. service 3.)
  523.  
  524.      In get_curr() it returns the value of register dh and in
  525.  
  526. get_curc it returns the value of register dl.
  527.  
  528.  
  529.  
  530. RETKEY(), INKEY(INT *ASCII)
  531.  
  532.  
  533.      These two functions return the scan code of the key that
  534.  
  535. was pressed.  It will also wait for a key to be pressed.
  536.  
  537.      If you go into the read program under the reference section
  538.  
  539. you will find a menu item called keyboard scan.  This function will
  540.  
  541. print out on the screen the scan code for any key you press.  If you
  542.  
  543. plan to use this function in you program I suggest you run
  544.  
  545. keyboard scan and get the values for the keys you want to use.
  546.  
  547.  
  548.  
  549.  
  550. READ_CHAR(INT X,INT Y)
  551.  
  552.      This function reads the character at screen coordinates
  553.  
  554. specified by x and y and returns it.  I used the BIOS
  555.  
  556. interrupt 0x10 service 8 to make this function work.
  557.  
  558.      This function is mainly used in the shadowing function
  559.  
  560. to read the character at a certain location and then rewrite
  561.  
  562. it with a different color.
  563.  
  564.  
  565.  
  566. GOTO_XY(INT X,INT Y)
  567.  
  568.      This function moves the curser to the specified x,y
  569.  
  570. coordinates on the screen.
  571.  
  572.      This function comes in very handy when you do a lot of
  573.  
  574. printing and you need it at a certain location.  An example
  575.  
  576. of how to use this function:
  577.  
  578.      goto_xy(10,10);printf("* the star is located at
  579.  
  580.                     coordinates 10,10);
  581.  
  582. you mainly want to use this function with a printf statement.
  583.  
  584. The write_char function below put characters at a certain
  585.  
  586. location so you don't need to use this function when you use
  587.  
  588. the other.
  589.  
  590.      This function uses BIOS interrupt 0x10 service 2 to do
  591.  
  592. what it does.
  593.  
  594.      When ever possible I suggest you use the write_char()
  595.  
  596. function because it is a lot quicker because it uses direct
  597.  
  598. memory access rather than interrupts and you only need to
  599.  
  600. call one function rather than two which you need to do with
  601.  
  602. the goto_xy() function.
  603.  
  604.  
  605. SIZE(CHAR *STRING[],INT *X,INT *Y)
  606.  
  607.      This function determines the minimum horizontal and
  608.  
  609. vertical size needed to print string[] to the screen.  This
  610.  
  611. function is used alot to determine how much space is
  612.  
  613. needed to store the old screen before string[] is printed to
  614.  
  615. the screen.
  616.  
  617.     This function returns the size of the array inside the x and
  618.  
  619. y varibles so if you call this function like:
  620.  
  621.         size(buffer,hor,ver);
  622.  
  623.     The minumin horizontal size will equal hor and the minumin
  624.  
  625. vertical size will equal ver.
  626.  
  627. SAVE_BKG(UNSIGNED CHAR *BUFFER,INT STARTX,INT STARTY,
  628.  
  629.           INT ENDX,INT ENDY)
  630.  
  631. RESTORE_BKG(UNSIGNED CHAR *BUFFER,INT STARTX,INT STARTY,
  632.  
  633.           INT ENDX,INT ENDY)
  634.  
  635.  
  636.  
  637.      These two functions either save the background before
  638.  
  639. the menu is printed over it or restores the background after
  640.  
  641. you are done with the menu.  Both of these functions operate
  642.  
  643. along the same principle with direct memory addressing.
  644.  
  645.  
  646.  
  647.  
  648. WRITE_CHAR(CHAR CHARACTER,INT X,INT Y,INT COLOR)
  649.  
  650.      This function writes a character and color to the screen
  651.  
  652. at coordinates specified by x and y.
  653.  
  654.  
  655.  
  656. COL_DISP(CHAR *TXT_BUFF[],INT X,INT Y,INT X1,INT Y1,INT
  657.  
  658.           COLOR)
  659.  
  660. STR(CHAR *BUFFER,INT X,INT Y,INT COLOR)
  661.  
  662.  
  663.  
  664.      The str() is used by the col_disp().  I wil explain the
  665.  
  666. str() function later in this section.
  667.  
  668.      The col_disp() function displays the information stored
  669.  
  670. in the *txt_buff[], with the color specified by the color
  671.  
  672. varible and puts it on the screen location specified by x,y.
  673.  
  674.      The first thing this function does is to determine how
  675.  
  676. many lines are in the txt_buff this is done by subtracting y
  677.  
  678. from y1 (y1 signifys endy) and puts it in the varible c.
  679.  
  680.      The next line in the program runs a loop c times.  This
  681.  
  682. lets the functions write every line to the screen.
  683.  
  684.      The third part of the program calls on function str() to
  685.  
  686. break the string into individual characters and prints it on
  687.  
  688. the screen.  The function then increments y for the next
  689.  
  690. line.
  691.  
  692.  
  693.  
  694.  
  695.  
  696. MNU_BAR(INT ROW,INT COL,INT WIDTH,INT COLOR,INT COLOR1,INT
  697.  
  698.           DEPTH,INT SMENU)
  699.  
  700. SLID_CUR(INT ROW,INT COL,INT WIDTH,INT COLOR,INT COLOR1,INT
  701.  
  702.           NUM,INT SMENU)
  703.  
  704.      These two functions operate on the same principle except
  705.  
  706. one is for slide bars (The menus at the top of screens) and
  707.  
  708. the other is for regular menus (The pull down menus.)
  709.  
  710.      Both of these functions need the same imfomation inputed
  711.  
  712. to them the only difference is that the men_bar() has a
  713.  
  714. interger named depth and the slid_cur has a interger named
  715.  
  716. num.  Both of these intergers mean the same thing (number of
  717.  
  718. menu items.)
  719.  
  720.      The row and col (y,x I was kind of backward the day I
  721.  
  722. made these functions so they are reversed) tells the function
  723.  
  724. where the first menu item is located.
  725.  
  726.      The width tells the function how long to make the menu
  727.  
  728. bar.
  729.  
  730.      The color and color1 defines the colors.  Color should
  731.  
  732. equal the color of the menu and color1 sould equal the color
  733.  
  734. you want the bar to be.
  735.  
  736.      The smenu is the menu that you want the bar to start at
  737.  
  738. usually this will be 1 (menu item 1.)
  739.  
  740.      Both of these functions return a 99 if the esc key was
  741.  
  742. pressed or the row or col number if the return was pressed.
  743.  
  744.  
  745.  
  746. DISP_BAR(INT ROW,INT COL,INT WIDTH,INT COLOR)
  747.  
  748.      This function is called by both functions mentioned
  749.  
  750. above.  It's purpose is to display the menu bar on the screen
  751.  
  752. at location col,row with the color specified and the
  753.  
  754. appropriate width.
  755.  
  756.  
  757.  
  758. DISP_CURS(INT ROW,INT COL,INT COLOR,INT X)
  759.  
  760.      If x is one this function displays an arrow at video
  761.  
  762. location col,row with the color specified.
  763.  
  764.      If x is zero this function erases what ever is at the
  765.  
  766. screen location col,row.
  767.  
  768.  
  769.  
  770. UNSIGNED INT *COL_MENU(CHAR *MENU[],INT STARTX,INT STARTY,INT
  771.  
  772.      ENDX,INT ENDY,INT COLOR,INT FRAME)
  773.  
  774. COL_RES(UNSIGNED INT *BC,INT STARTX,INT STARTY,INT ENDX,INT
  775.  
  776.          ENDY)
  777.  
  778. SCROLL(INT WAY,INT STARTX,INT STARTY,INT ENDX,INT ENDY,INT
  779.  
  780.         NUM,INT COLOR)
  781.  
  782. CLS(INT COLOR)
  783.  
  784.  
  785.      The function col_menu has to be defined as an unsigned
  786.  
  787. int * because it returns a unsigned interger pointer that
  788.  
  789. points to the address that the old screen was saved to.
  790.  
  791.      I am not going to go into these functions because I
  792.  
  793. think that anyone that has got this for and understands
  794.  
  795. everything so far should have little to no trouble figuring
  796.  
  797. out how these function works.  If you do have any problems
  798.  
  799. please fell free to contact me via my E-Mail number and I
  800.  
  801. will be more than happy to answer you questions.
  802.  
  803.  
  804. MOUS_CUR(INT ROW,INT COL,INT WIDTH,INT COLOR,INT COLOR1
  805.  
  806.               INT DEPTH,INT WIDTH,INT SMENU)
  807.  
  808. MOUS_SLID(INT ROW,INT COL,INT WIDTH,INT NUM,INT SMENU)
  809.  
  810. BUTTON_REL()
  811.  
  812.  
  813.  
  814.      These three functions are mouse menu functions().  Look
  815.  
  816. at the mous.lib section and the mnu_bar() and slid_bar()
  817.  
  818. functions and try to figure out how they do what they do it
  819.  
  820. will be a big help for when you try to do your own and if you
  821.  
  822. have any questions fell more than free to contact me.
  823.  
  824.  
  825. MOUSEx.C FUNCTIONS:
  826.  
  827.      Refer to appendix b to get infomation on the mouse
  828.  
  829. functions.  The only mouse function that I will go indepth
  830.  
  831. into here is the SETGRAPHPOINTER().  All of the mouse
  832.  
  833. functions use DOS interrupt 0x33 to make the calls work.
  834.  
  835.      All of the mouse functions pass a varibles to a function
  836.  
  837. called mouse().  The first varible is interrupt 0x33's
  838.  
  839. service number and the varibles after that are the values to
  840.  
  841. be passed back to the main function.
  842.  
  843.      Mouse() excepts four arguments that it places in
  844.  
  845. pointers arg1 to arg4 and points the values into the
  846.  
  847. registers (ax,bx,cx and dx.)  Then it does the interrupt call
  848.  
  849. and places the register values into the address of the
  850.  
  851. arguments that were passed to it and returns.
  852.  
  853. SETGRAPHPOINTER(UNSIGNED PTRMSK[],INT X,INT Y)
  854.  
  855.  
  856.      The ptrmsk[] is an array of numbers that define the
  857.  
  858. shape of the pointer.  example the cross:
  859.  
  860.      HEX FORM  BINARY FORM
  861.  
  862.      0xfc3f=   1111110000111111
  863.      0xfc3f=   1111110000111111
  864.      0xfc3f=   1111110000111111
  865.      0x0000=   0000000000000000
  866.      0x0000=   0000000000000000
  867.      0x0000=   0000000000000000
  868.      0xfc3f=   1111110000111111
  869.      .
  870.      .
  871.      .
  872.      0x0000=   0000000000000000
  873.      0x0180=   0000000110000000
  874.      0x0180=   0000000110000000
  875.      0x0180=   0000000110000000
  876.      0x7ffd=   0011111111111100
  877.      .
  878.      .
  879.      .
  880.      The first 16 elements are anded with the second 16
  881.  
  882. elements to give you the cursor you disire.  There are more
  883.  
  884. cursors in shape.h that you can use or you can add you own to
  885.  
  886. it.  If you have any problems please fell free to contact me
  887.  
  888. and I will give you as much help as possible.
  889.  
  890.      ANDED:
  891.  
  892.           0 AND 0 = 0
  893.  
  894.           0 AND 1 = 0
  895.  
  896.           1 AND 0 = 0
  897.  
  898.           1 AND 1 = 1
  899.  
  900.      Since the cursor isn't the size of one pixel we need to
  901.  
  902. define which pixel will represent where the cursor is located
  903.  
  904. that is where x and y come in they define the cursor's 'hot
  905.  
  906. spot' or what part of the cursor represents where the cursor
  907.  
  908. is.
  909.  
  910. UTLx.LIB FUNCTIONS:
  911.  
  912.      The utl functions are just like the mouse functions,
  913.  
  914. They all use interrupts to make the functions work.  Refer to
  915.  
  916. appendix c for information on what each function does.
  917.  
  918.  
  919.  
  920.  
  921.  
  922. APPENDIX A:
  923.  
  924. BRIEF FUNCTION DISCRIPTIONS FOR MENUx.C:
  925.  
  926.   MODE (INT MODE_CODE)
  927.     This function excepts an interger mode_code.
  928.  This function sets the video to the mode specified
  929.  by mode_code.
  930.  
  931.  
  932.  
  933.   GET_CURR()
  934.     This function excepts no values but returns the
  935.  row that the cursor is at.
  936.  
  937.  
  938.  
  939.   GET_CURC()
  940.     This function is just like the one above
  941.  except it returns the column that the cursor is at.
  942.  
  943.  
  944.  
  945.   RETKEY()
  946.     This function excepts no values but returns
  947.  the scan code of a key pressed.  It will wait
  948.  for a key to be pressed before it returns to the
  949.  program.
  950.  
  951.  
  952.  
  953.   GOTO_XY(INT X,INT Y)
  954.     This function will put the cursor to the
  955.  specified x,y corrdinates on the screen.
  956.  
  957.  
  958.  
  959.   SIZE (CHAR *STRING, INT *X,INT *Y)
  960.     This function will return the maximum size
  961.  of the buffer pointed to by *string (both length and width.)
  962.  The function will put the size in the varibles x and y
  963.  for return.
  964.  
  965.  
  966.  
  967.   SAVE_BKG( UNSIGNED CHAR *BUFFER, INT STARTX,INT STARTY
  968.          ,INT ENDX,INT ENDY)
  969.     This function will save a portion of the screen specifed
  970. by the startx, starty, endx and endy varibles.  Before you
  971. run this function you need to allocate some memory.  Below is
  972. an example of how to save the screen.
  973.  
  974.  unsigned int *pointer;
  975.  char *buffer[]={
  976.    /*put menu here*/
  977.  int x,y,startx,starty;
  978.  size (buffer,x,y);
  979.  pointer=(unsigned int*)malloc (2*(x+2)*(y+2));
  980.  save_bkg(pointer,startx,starty,startx+x,starty+y);
  981.  
  982.  
  983.  
  984.   RESTORE_BKG(UNSIGNED CHAR *BUFFER,INT STARTX,INT STARTY
  985.           INT ENDX,INT ENDY),
  986.        This function restores the background saved by
  987. save_bkg().
  988. You want to make sure you restore it to the same spot you
  989. saved it from.  Also you need to free the pointer when you
  990.  are done below is an example that goes along with the
  991. others.
  992.  restore(pointer,startx,starty,startx+x,starty+y);
  993.  free(pointer);
  994.  
  995.  
  996.  
  997.   WRITE_CHAR(CHAR CHARACTER,INT X,INT Y,INT COLOR)
  998.     This function writes a character to the screen at
  999.  coordinates x,y and puts it in the color specified
  1000.  by the varible color.
  1001.  
  1002.  
  1003.  
  1004.  
  1005.   COL_DISP(CHAR *BUFFER,INT X,INT Y,INT COLOR)
  1006.     This function displays a character buffer starting at
  1007.  coordinates x,y and in the color specified by the varible
  1008.  color. mem.h is some example of char buffers.
  1009.  
  1010.  
  1011.  
  1012.  
  1013.   MNU_CURS(INT ROW,INT COL,INT COLOR,INT DEPTH)
  1014.     This function will make a menu cursor for you
  1015.  starting at the specifier row ,column and will
  1016.  go down through depth number of menus.
  1017.  When I made these functions I was kind of backwards so
  1018.  remember row ins the y axis and col is the x axis.
  1019.  This function returns the y position of the cursor
  1020.  and breaks on either 'enter' or 'esc'
  1021.  
  1022.  
  1023.  
  1024.   MNU_BAR(INT ROW,INT COL,INT WIDTH,INT COLOR,
  1025.          INT COLOR1,INT DEPTH,INT SMENU)
  1026.        This function will make a bar rather than a cursor
  1027.  that was in the last function.  Row,col,depth have the same
  1028.  roles as in the last function.  Width is how wide you want
  1029.  the bar to be.  Color is the color of the menu.  Color1 is
  1030.  the color you want the bar to be.  Smenu is which menu you
  1031.  want to start with.  This function returns the y position of
  1032.  the cursor and breaks on either 'enter' or 'esc'
  1033.  
  1034.  
  1035.  
  1036.  
  1037.   SLID_CUR(INT ROW,INT COL,INT WIDTH,INT COLOR,
  1038.          INT COLOR1, INT NUM, INT SMENU)
  1039.        This function make a slide bar menu (instead of going
  1040.  un and down like the last two it goes left to right.)
  1041.  All the varibles have the same function as the ones in the
  1042.  last function.  Num is the num of menus and width specifies
  1043.  the width of the bar as well as how far to jump each time
  1044.  you press the arrow keys
  1045.  This function returns the x position of the cursor
  1046.  and breaks on either 'enter' or 'esc'
  1047.  
  1048.  
  1049.  
  1050.   COL_MENU(CHAR *BUFFER,INT STARTX,INT STARTY,INT ENDX,
  1051.          INT ENDY,INT COLOR,INT FRAME)
  1052.        This function saves the screen, draws the menu with
  1053. the specified color, draws a border (if you want one), draws
  1054. a  shadow (if you have a frame) and returns an unsigned int
  1055.  pointer all in one function.  The border can be one of five
  1056.  borders specified by the frame varible:
  1057.       0=no border or shadow
  1058.       1=┌───┐ and a shadow
  1059.       2=╓───╖ and a shadow
  1060.       3=╒═══╕ and a shadow
  1061.       4=╔═══╗ and a shadow
  1062.  In the next function is an example of haw to call this
  1063.  function
  1064.  
  1065.  
  1066.  
  1067.  
  1068.   COL_RES(UNSIGNED IN *POINTER,INT STARTX,INT STARTY,
  1069.          INT ENDX,INT ENDY)
  1070.        This function is used in conjunction with the one
  1071. above.
  1072.  If you use the function above you need to use this one to
  1073.  restore the screen.  Below is an example.
  1074.  unsigned int *p1;
  1075.  int startx,starty,x,y;
  1076.  char *buffer={
  1077.   /*put menu here*/
  1078.  size (buffer,x,y);
  1079.  p1=col_menu(buffer,startx,starty,startx+x,starty+y,20,4);
  1080.  /*menu cursor functions here*/
  1081.  col_res(p1,startx,starty,startx+x,starty+y);
  1082.  free(p1);  /*note you still have to free your pointer*/
  1083.  
  1084.      SCROLL(INT WAY,INT STARTX,INT STARTY,INT ENDX,INT
  1085.             ENDY,INT NUM,INT COLOR)
  1086.  
  1087.      This function scrolls a part of the screen defined by
  1088. startx,starty and endx,endy either up or down num number of
  1089. times and with color defined by color.
  1090.      If you want the screen to scroll up way has to be equal
  1091. to 1 and if you want it to scroll down way has to be 2.
  1092.  
  1093. CLS(INT COLOR)
  1094.  
  1095.      This function clears the screen and put the color
  1096. defined by the color varible.
  1097.  
  1098. MOUS_CUR(INT ROW,INT COL,INT WIDTH,INT COLOR,INT COLOR1,INT
  1099.  
  1100.      DEPTH, INT SMENU)
  1101.  
  1102.      This function is basicly the same as mnu_bar() but
  1103. instead of using keys for input it uses the mouse for cursor
  1104. input.  All of the varible are the same as mnu_bar.
  1105.  
  1106.  
  1107. MOUS_SLID(INT ROW,INT COL,INT WIDTH,INT SMENU)
  1108.  
  1109.      This is the mouse version of slid_cur() function.  They
  1110. do pretty much the same thing except mous_slid uses a mouse
  1111. while slid_cur uses keys for input.
  1112.      The varibles are the same as in slid_cur but with a few
  1113. deleted.
  1114.  
  1115.  
  1116.  
  1117. BUTTON_REL()
  1118.  
  1119.      Thing function returns when the mouse buttons are no
  1120. longer pressed.
  1121.  
  1122.  
  1123.  
  1124. APPENDIX B:
  1125.  
  1126. BREIF FUNCTION DISCRIPTIONS FOR MOUSx.C:
  1127.  
  1128.  
  1129.   CURSOR_OFF()
  1130.     This function removes the mouse cursor
  1131. from the screen.
  1132.     This function excepts and returns no values.
  1133.  
  1134.  
  1135.   CURSOR_ON()
  1136.     This function shows the mouse cursor
  1137. on the screen.
  1138.     This function excepts and returns no values.
  1139.  
  1140.  
  1141.   RIGHTB_PRESSED()
  1142.     This function detects if the
  1143. right mouse button was pressed.
  1144.     This function excepts no values
  1145. but returns a 1 if the button was pressed
  1146. or a 0 if the button was not pressed
  1147.  
  1148.  
  1149.   LEFTB_PRESSED()
  1150.     This function detects if the
  1151. left mouse button was pressed.
  1152.     This function excepts no values
  1153. but returns a 1 if the button was pressed
  1154. or a 0 if the button was not pressed
  1155.  
  1156.  
  1157.      SET_MOUSE_POSITION(INT X,INT Y)
  1158.     This function sets the mouse cursor
  1159. to the x y position on the screen
  1160.     This function excepts two interger
  1161. for the x y coordinates but returns
  1162. no values.
  1163.  
  1164.  
  1165.      MOUSE_POSITION(INT *X,INT *Y)
  1166.     This function returns the current
  1167. position of the mouse cursor on the screen.
  1168.     This function excepts two pointers to
  1169. intergers.  The pointers recieve the current
  1170. poition of the mouse cursor.
  1171.  
  1172.  
  1173.      MOUSE_MOTION(INT *X,INT *Y)
  1174.     This function returns a one in x
  1175. if the mouse x value has changed since the
  1176. last read.  It also returns a one in y
  1177. if the mouse y value has changed since the
  1178. last read.
  1179.  
  1180.  
  1181.      MOUSE_RESET()
  1182.     This function resets the mouse to
  1183. the default values and returns a 10
  1184. if mouse hardware are software is not
  1185. installed.
  1186.  
  1187.  
  1188.      MOUSEXLIMIT(INT X1,INT X2)
  1189.     This function sets the limit (on the x
  1190. axis) that the mouse can move.
  1191. x1=minimum x value
  1192. x2=maximun x value
  1193.  
  1194.  
  1195.      MOUSEYLIMIT(INT Y1,INT Y2)
  1196.     This function sets the limit (on the y
  1197. axis) that the mouse can move.
  1198. y1=minimum y value
  1199. y2=maximum y value
  1200.  
  1201.  
  1202.      SETMICKY(INT X,INT Y)
  1203.     This function sets the micky to pixel
  1204. ration.  The range can be from 1-32767.
  1205. Default values:
  1206. x=8
  1207. y=16
  1208.  
  1209.  
  1210.      DOUBLESPEED(INT X)
  1211.     This function sets the double
  1212. speed threshold.
  1213. default is 64
  1214.  
  1215.  
  1216.      SETSENSITIVITY(INT XMICKY,INT YMICKY,INT DOUBLE)
  1217.     This function is a combination of the two
  1218. above functions.  This is to save steps in your
  1219. programs.
  1220.  
  1221.  
  1222.      GETSENSITIVITY(INT *XMICKY,INT *YMICKY,INT *DOUBLE)
  1223.     This function returns the current vaules for
  1224. mickys to pixel ratio and the double speed
  1225. threshold.
  1226.     This function excepts three pointers to intergers.
  1227.  
  1228.  
  1229.      SETTEXPNTR(INT TYPE
  1230.     This function sets the text pointer
  1231. to any ASCII character.
  1232. This function excepts an interger from 0-255
  1233. and will change the text cursor to that ASCII
  1234. character.
  1235.  
  1236.  
  1237.      SETGRAPHPNTR(UNSIGNED PTRMSK[],INT X,INT Y)
  1238.     This function changes the graphic cursor
  1239. to the shape and color defined in PTRMSK[].
  1240.     The file SHAPE.H has a few different shapes
  1241. in it.
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250. APPENDIX C:
  1251.  
  1252. BRIEF FUNCTION DEFINATIONS FOR UTLx.C:
  1253.  
  1254.  
  1255.        EQU_INFO (INT *EQU_RT)
  1256.        This function obtains the equipment list code
  1257. stored in ROM bios.
  1258. bit 0 = 1 if floppy drive is installed
  1259. bit 1 = 1 if math co-processer is installed
  1260. bit 2-3 = system board RAM size
  1261.    00b 16KB, 01b 32KB, 10b 48KB, 11b 64KB
  1262. bit 4-5 = initial video mode
  1263.    01b 40X25 color, 10b color, 11b monochrome
  1264. bit 6-7 = number of floppies installed
  1265.    00b=1, 01b=2, 10b=3, 11b=4
  1266. bit 9-11 = number of RS232 ports installed
  1267. bit 12 = 1 if game adapter installed
  1268. bit 13 = 1 if internal modem is installed
  1269. bit 14-15 = number of printers installed
  1270. You would want to use this function if your program needs
  1271. certain equipment in order to run.
  1272.  
  1273.  
  1274.        DOS_VER(INT *MIN,INT *MAJ,INT *OEM)
  1275.        This function returns the DOS major, minor and oem
  1276. version that is currently running on your machine
  1277. You would want to use this function if your program needs a
  1278. certain DOS version or higher to run.
  1279.  
  1280.  
  1281.        MEMORY(UNSIGNED INT *MEM)
  1282.        This function returns the amount of convential
  1283. memory available to dos.
  1284. This function does not include extended or expanded memory.
  1285. You would want to use this function if your program needs a
  1286. minimum amount of memory to run.
  1287.  
  1288.  
  1289.        WARM_BOOT()
  1290.        This function does not proform a complete reboot
  1291.        process.
  1292. What it does is proforms a partial memory check
  1293. and resets the processor registers.
  1294.  
  1295.  
  1296.        GET_TIME(INT *HOURS,INT *MIN,INT *SEC,INT
  1297.        *HUNDREDTHS_SEC)
  1298.        This function obtains the system time and returns
  1299. it to four interger listed above that can be displayed
  1300. like this:  hours:min:sec:hundredths_sec
  1301.  
  1302.  
  1303.        GET_DATE(INT *MONTH,INT *DAY,INT *YEAR)
  1304.        This function obtains the system date and returns
  1305. it in three intergers listed above that can be displayed
  1306. like this:   month/day/year
  1307. year is returned with values ranging from 1980 to 2099
  1308.  
  1309.  
  1310.        ROTATE (UNSIGNED INT *VALUE,INT N)
  1311.        This function rotates the bit values of the
  1312. giving number (value) n number of times.
  1313. If n is negitive the bits rotate to the left
  1314. If n is positive the bits rotate to the right
  1315. This function works good when you need to find out what
  1316. certain bit contain after you mask it
  1317.  
  1318.  
  1319.        INT_SIZE(UNSIGNED INT *SIZE)
  1320.        This function returns the bit size of the machine.
  1321. You would want to use this function if you program
  1322. requires a certain type of machine ie:80286 or higher
  1323.  
  1324.  
  1325.        SET_DAT(INT YEAR,INT MONTH,INT DAY)
  1326.        This function sets the date on the machine
  1327. Year has to be between 1980 - 2099
  1328.  
  1329.  
  1330.        SET_TIME(INT HOUR,INT MIN,INT SEC)
  1331.        This function sets the internal clock of the computer.
  1332. Hour must be in the 24 hour format because the clock also
  1333. moves the date when the time goes past midnight.
  1334.